from urllib import request

from django.shortcuts import render
from .models import Company


# Create your views here.
def index(request):
    companys = Company.objects.all()
    companys = list(companys)
    companys.sort( key=lambda x: x.rate, reverse=True)
    first = companys[0]
    second = companys[1]
    third = companys[2]
    print(first)
    print(second)
    print(third)
    context = {
        'first':first,
        'second':second,
        'third':third,
    }
    return render(request, 'index.html', context=context)
